SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vwlfichasanitaria
AS
SELECT     dbo.tb_FichaSanitaria.idFichaSanitaria AS ID, dbo.vwrAlumnos.Descripcion, dbo.tb_Caracteristicas.Caracteristica, dbo.tb_FichaSanitaria.Valor, 
                      dbo.tb_ValoresCaracteristicas.Caracteristica AS ValorCBO, dbo.tb_FichaSanitaria.FechaRegistro, dbo.tb_FichaSanitaria.Observaciones, 
                      dbo.tb_FichaSanitaria.Responsable, dbo.tb_FichaSanitaria.RegistroVigente, dbo.tb_FichaSanitaria.FechaFinVigencia
FROM         dbo.tb_FichaSanitaria INNER JOIN
                      dbo.tb_Caracteristicas ON dbo.tb_FichaSanitaria.CaracteristicaSanitaria = dbo.tb_Caracteristicas.idCaracteristica INNER JOIN
                      dbo.tb_ValoresCaracteristicas ON dbo.tb_FichaSanitaria.ValorCBO = dbo.tb_ValoresCaracteristicas.idValorCaracteristica AND 
                      dbo.tb_Caracteristicas.idCaracteristica = dbo.tb_ValoresCaracteristicas.Caracteristica INNER JOIN
                      dbo.vwrAlumnos ON dbo.tb_FichaSanitaria.Alumno = dbo.vwrAlumnos.ID
GO
GRANT SELECT ON  [dbo].[vwlfichasanitaria] TO [SoloVer]
GO
